#! /usr/bin/env python
#coding:utf-8
#socket测试，多client，与socketSer.py配合；

from socket import *

HOST=''
PORT=21567
ADDR=(HOST,PORT)
BUFSIZ=4096

while True:
    tcpCliSock=socket(AF_INET,SOCK_STREAM)
    tcpCliSock.connect(ADDR)
    data=raw_input('> ')
    if not data:
        break
    tcpCliSock.sendall('%s\r\n' % data)
    data=tcpCliSock.recvfrom(BUFSIZ)
    if not data:
        break
    else:
        print 'server send message is:  \n'
        for result in data:
            print result


    tcpCliSock.close()